#ifndef OPERATIONFACTORY_H
#define OPERATIONFACTORY_H

#include <QObject>
#include <QMap>


class Operation;
class Memory;
class CPU;

class OperationFactory : public QObject
{
public:
    virtual ~OperationFactory();
    //
    Operation* getOperation(const QString IR);

public:
    static OperationFactory* getInstance(Memory* _memory, CPU* _cpu, QObject* parent = 0);

private:
    OperationFactory(Memory* _memory, CPU* _cpu, QObject* parent = 0);

private:
    static OperationFactory* factory;
    QMap<QString, Operation*> operations;
    QMap<QString, Operation*> operationsI;

private:
    static const QString ADD;
    static const QString SUB;
    static const QString AND;
    static const QString OR;
    static const QString XOR;
    static const QString LHI;
    static const QString SLL;
    static const QString SRL;
    static const QString SRA;
    static const QString SLT;
    static const QString SLE;
    static const QString SEQ;
    static const QString SNE;
    static const QString LW;
    static const QString SW;
    static const QString LB;
    static const QString SB;
    static const QString BEQZ;
    static const QString BNEZ;
    static const QString J;
    static const QString JR;
    static const QString JAL;
    static const QString JALR;
    static const QString TRAP;
    static const QString XFE;
};

#endif // OPERATIONFACTORY_H
